#pragma region Licensing
/*
       LOGL::GLib -> LorgonJortle's OpenGL Game Library
       Copyright (C) 2011  Jesse 'LorgonJortle' Wilkerson

       This program is free software: you can redistribute it and/or modify
       it under the terms of the GNU General Public License as published by
       the Free Software Foundation, either version 3 of the License, or
       (at your option) any later version.

       This program is distributed in the hope that it will be useful,
       but WITHOUT ANY WARRANTY; without even the implied warranty of
       MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
       GNU General Public License for more details.

       You should have received a copy of the GNU General Public License
       along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/
#pragma endregion

#include "Material.h"

namespace LOGL_GLib
{
     namespace Content
     {
          /******************************************************************************
           Material::Material();
                    Arguments:
                         void

                    Description:
                         Constructs a Material object and sets its defaults.

                    Returns:
                         The Material object.
          *******************************************************************************/
          Material::Material()
          {
               /* Set defaults. */
               SetDefaults();
          }

          /******************************************************************************
           Material::~Material();
                    Arguments:
                         void

                    Description:
                         Destructs the Material object and releases any indebted resources.

                    Returns:
                         void
          *******************************************************************************/
          Material::~Material()
          {
               Unbind();

               Texture.Destroy();
          }

          /******************************************************************************
           GLvoid Material::SetDefaults();
                    Arguments:
                         void

                    Description:
                         Sets the default values and clears any texture data.

                    Returns:
                         void
          *******************************************************************************/
          GLvoid Material::SetDefaults()
          {
               Name = "LOGL::GLib Material";

               Ambient.X = 1.0f;
               Ambient.Y = 1.0f;
               Ambient.Z = 1.0f;

               Diffuse.X = 0.8f;
               Diffuse.Y= 0.8f;
               Diffuse.Z= 0.8f;

               Specular.X = 1.0f;
               Specular.Y= 1.0f;
               Specular.Z = 1.0f;

               Alpha = 1.0f;
               Shininess = 0.0f;

               /* Get rid of any texture data. */
               Texture.Destroy();
          }

          /******************************************************************************
           GLvoid Material::Bind() const;
                    Arguments:
                         void

                    Description:
                         Binds the material to the current state.

                    Returns:
                         void
          *******************************************************************************/
          GLvoid Material::Bind() const
          {
               Texture.Bind(GL_TEXTURE0);
          }

          /******************************************************************************
           GLvoid Material::Unbind() const;
                    Arguments:
                         void

                    Description:
                         Unbinds the material to the current state.

                    Returns:
                         void
          *******************************************************************************/
          GLvoid Material::Unbind() const
          {
               Texture.Unbind();
          }

     } /* Namespace Content. */
} /* Namespace LOGL_GLib. */
